package com.nidu.demo.dept.dto;

import com.nidu.demo.base.BaseCmd;
import com.nidu.demo.common.constants.Constants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 部门添加命令
 *
 * @author auto
 */
@Data
@Schema(description = "部门添加命令")
@EqualsAndHashCode(callSuper = true)
public class DepartmentAddCmd extends BaseCmd {

    /**
     * 部门名称
     */
    @NotBlank(message = "部门名称不能为空")
    @Size(max = 64, message = "部门名称长度不能超过64个字符")
    @Schema(description = "部门名称", example = "技术部")
    private String deptName;

    /**
     * 部门编码
     */
    @NotBlank(message = "部门编码不能为空")
    @Pattern(regexp = "^[A-Za-z0-9_]{2,32}$", message = "部门编码只能包含字母、数字和下划线，长度在2-32之间")
    @Schema(description = "部门编码", example = "tech")
    private String deptCode;

    /**
     * 父部门ID
     */
    @Schema(description = "父部门ID", example = "0")
    private Long parentId = Constants.ROOT_DEPT_ID;

    /**
     * 公司ID
     */
    @NotNull(message = "公司ID不能为空")
    @Schema(description = "公司ID", example = "1")
    private Long companyId;

    /**
     * 部门领导人ID
     */
    @Schema(description = "部门领导人ID", example = "1")
    private Long leader;

    /**
     * 部门联系电话
     */
    @Pattern(regexp = "^[0-9-]{7,15}$", message = "部门电话格式不正确")
    @Schema(description = "部门联系电话", example = "010-12345678")
    private String phoneNumber;

    /**
     * 部门邮件
     */
    @Pattern(regexp = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", message = "邮箱格式不正确")
    @Schema(description = "部门邮件", example = "tech@company.com")
    private String email;

    /**
     * 描述
     */
    @Size(max = 255, message = "描述长度不能超过255个字符")
    @Schema(description = "描述", example = "这是一个技术部门")
    private String remark;

}